package com.mifengs.mall.floor;

import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.MultipleItemRvAdapter;
import com.mifengs.mall.entity.FloorBean;

import java.util.List;

/**
 * Created by lihaoqi on 2018/4/16.
 */

public class FloorListAdapter extends MultipleItemRvAdapter<FloorBean,BaseViewHolder> {

    public static final int TYPE_ZERO = 0; //空楼层不做显示

    public static final int TYPE_ONE = 1;

    public static final int TYPE_TWO = 2;

    public static final int TYPE_THREE = 3;

    public static final int TYPE_FOUR = 4;

    public static final int TYPE_FIVE = 5;

    public static final int TYPE_SIX = 6;

    public static final int TYPE_SEVEN = 7;

    public static final int TYPE_EIGHT = 8;

    public static final int TYPE_NICE = 9;

    public static final int TYPE_TEN = 10;

    public static final int TYPE_ELEVEN = 11;

    public static final int TYPE_TWELVE = 12;

    public static final int TYPE_THIRTEEN = 13;

    public static final int TYPE_FOURTEEN = 14;

    public static final int TYPE_FIFTEEN = 15;

    public static final int TYPE_SIXTEEN = 16;

    public static final int TYPE_SEVENTEEN = 17;

    public static final int TYPE_EIGHTEEN = 18;

    public static final int TYPE_NINETEEN = 19;

    public static final int TYPE_TWENTY = 20;

    public static final int TYPE_TWENTY_ONE = 21;

    public static final int TYPE_TWENTY_TWO = 22;

    public FloorListAdapter(@Nullable List data) {
        super(data);
        finishInitialize();
    }

    @Override
    protected int getViewType(FloorBean bean) {
        if(bean.getTemplate()>22||bean.getTemplate()==TYPE_SEVENTEEN){
            return TYPE_ZERO;
        }else{
            return bean.getTemplate();
        }
    }

    @Override
    public void registerItemProvider() {
        mProviderDelegate.registerProvider(new FloorZeroProvider());
        mProviderDelegate.registerProvider(new FloorOneItemProvider());
        mProviderDelegate.registerProvider(new FloorTwoItemProvider());
        mProviderDelegate.registerProvider(new FloorThreeItemProvider());
        mProviderDelegate.registerProvider(new FloorFourItemProvider());
        mProviderDelegate.registerProvider(new FloorFiveItemProvider());
        mProviderDelegate.registerProvider(new FloorSixItemProvider());
        mProviderDelegate.registerProvider(new FloorSevenItemProvider());
        mProviderDelegate.registerProvider(new FloorEightItemProvider());
        mProviderDelegate.registerProvider(new FloorNiceItemProvider());
        mProviderDelegate.registerProvider(new FloorTenItemProvider());
        mProviderDelegate.registerProvider(new FloorElevenItemProvider());
        mProviderDelegate.registerProvider(new FloorTwelveItemProvider());
        mProviderDelegate.registerProvider(new FloorThirteenProvider());
        mProviderDelegate.registerProvider(new FloorFourteenProvider());
        mProviderDelegate.registerProvider(new FloorFifteenProvider());
        mProviderDelegate.registerProvider(new FloorSixTeenProvider());
        mProviderDelegate.registerProvider(new FloorSeventeenItemProvider());
        mProviderDelegate.registerProvider(new FloorEighteenItemProvider());
        mProviderDelegate.registerProvider(new FloorNineteenItemProvider());
        mProviderDelegate.registerProvider(new FloorTwentyItemProvider());
        mProviderDelegate.registerProvider(new FloorTwentyOneItemProvider());
        mProviderDelegate.registerProvider(new FloorTwentyTwoItemProvider());
    }

}
